#ifndef __REG_H__
#define __REG_H__

#include <stdint.h>

typedef struct{
    uint16_t addr;
    uint16_t len;
    enum{
        REG_ONLY_READ = 0,
        REG_READ_WRITE
    }rw;
    void *data;
    int (*check)(void *arg);
    void (*func)(void *arg);
}reg_obj;

typedef struct reg_map_t{
    uint16_t addr;
    uint16_t start_reg;
    uint16_t len;
    void *reg_data;
    struct reg_map_t* next;
}reg_map_t;

#define REG_HOLD_START_ADDR  0
#define REG_HOLD_LEN         10
#define REG_HOLD_END_ADDR    (REG_HOLD_START_ADDR + REG_HOLD_LEN - 1)

uint16_t reg_hold_read(uint16_t addr);
uint16_t reg_hold_write(uint16_t addr, uint16_t data);
uint16_t reg_hold_addr_check(uint16_t addr);
uint16_t reg_hold_init(void);
void reg_hold_event(uint16_t addr, uint16_t len);

#endif

